Skip to content

feat: add Khipro compositional input method#49

Open
qomarhsn wants to merge 1 commit into
OpenBangla:masterfrom
qomarhsn:feature/khipro-compositional
Open

feat: add Khipro compositional input method#49
qomarhsn wants to merge 1 commit into
OpenBangla:masterfrom
qomarhsn:feature/khipro-compositional

Conversation

@qomarhsn

Copy link
Copy Markdown

Introduce a third input-method category alongside phonetic and fixed: "compositional", which turns a roman key sequence into Bengali through a deterministic engine. Khipro is the first such layout, driven by an embedded m17n .mim spec.

  • src/compositional/: CompositionalEngine trait, Method impl (tape replay
    • backspace), and a pure-Rust port of the khipro library's s-expression parser, spec AST, and FSM interpreter (mim/).
  • config: add LayoutMethod + compositional_suggestion setting; recognize the built-in "khipro" layout name.
  • context: dispatch to CompositionalMethod via layout_method().
  • ffi: riti_config_set_compositional_suggestion (+ riti.h declaration).

The first candidate is the exact Khipro composition; dictionary/emoji suggestions follow, as with the fixed method. The candidate-window auxiliary text shows the raw roman keystrokes.

Vendored data (data/khipro/), MIT licensed:

  • bn-khipro.mim (c) 2024 rank_coder - embedded at runtime
  • khipro-testcases.csv - used only by the #[cfg(test)] conformance test

Introduce a third input-method category alongside phonetic and fixed:
"compositional", which turns a roman key sequence into Bengali through a
deterministic engine. Khipro is the first such layout, driven by an
embedded m17n `.mim` spec.

- src/compositional/: CompositionalEngine trait, Method impl (tape replay
  + backspace), and a pure-Rust port of the khipro library's s-expression
  parser, spec AST, and FSM interpreter (mim/).
- config: add LayoutMethod + compositional_suggestion setting; recognize
  the built-in "khipro" layout name.
- context: dispatch to CompositionalMethod via layout_method().
- ffi: riti_config_set_compositional_suggestion (+ riti.h declaration).

The first candidate is the exact Khipro composition; dictionary/emoji
suggestions follow, as with the fixed method. The candidate-window
auxiliary text shows the raw roman keystrokes.

Vendored data (data/khipro/), MIT licensed:
- bn-khipro.mim  (c) 2024 rank_coder  - embedded at runtime
- khipro-testcases.csv  - used only by the #[cfg(test)] conformance test
@mominul

mominul commented Jun 27, 2026

Copy link
Copy Markdown
Member

@qomarhsn Hi!

Thanks for the pull request! But have you checked the OpenBangla/OpenBangla-Keyboard#426 ticket beforehand? We already have Khipro support in the Okkhor crate. The remaining work was about generating suggestions for Khipro, which I have done initially in the khipro branch in the upodesh repo.

Can you give me the rationale why we should proceed to have a .mim based layout system?

@qomarhsn

qomarhsn commented Jun 28, 2026

Copy link
Copy Markdown
Author

Thanks for the pull request! But have you checked the OpenBangla/OpenBangla-Keyboard#426 ticket beforehand? We already have Khipro support in the Okkhor crate.

Can you give me the rationale why we should proceed to have a .mim based layout system?

I had seen this discussion initially, but I forgot about it while implementing Khipro in Riti.
In that case, Khipro itself should be implemented in Okkhor rather than directly in Riti. Therefore, the direct layout implementation introduced in this PR should be removed from here. However, since Khipro is a compositional layout and its rules are still evolving, I think maintaining a Khipro-specific m17n interpreter in Okkhor would make future updates much easier. In most cases, updating the .mim file would be sufficient instead of modifying the implementation each time.
cc: @gulshan

The remaining work was about generating suggestions for Khipro, which I have done initially in the khipro branch in the upodesh repo.

I think it would be better to use Upodesh's existing suggestion mechanism for Bangla/fixed layouts based on Khipro's composed Bengali output, rather than introducing an Avro-style suggestion mechanism. Since Khipro already produces the composed Bengali output, I believe this approach should be sufficient and would likely work better for Khipro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants